package com.sixnimmt.app.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.RootPanel;
import com.sixnimmt.app.client.game.GameService;
import com.sixnimmt.app.client.game.GameServiceAsync;
import com.sixnimmt.app.client.i18n.SixNimmtMessages;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class SixNimmtApp implements EntryPoint {

	/**
	 * Create a remote service proxy to talk to the server-side game service.
	 */
	private final GameServiceAsync gameService = GWT.create(GameService.class);
	private final SixNimmtMessages messages = GWT.create(SixNimmtMessages.class);

	/**
	 * This is the entry point method.
	 */
	@Override
	public void onModuleLoad() {

		// Add the nameField and sendButton to the RootPanel
		// Use RootPanel.get() to get the entire body element
		RootPanel rootPanel = RootPanel.get("game");

		HandlerManager eventBus = new HandlerManager(null);
		AppController appController = new AppController(gameService, eventBus, messages);
		appController.go(rootPanel);
	}
}
